<extend name="Common:base" />
<block name="head">
  <style>
    .el-table__body tr.current-row>td{
      background: rgba(157, 195, 232, 0.7);
    }
		#edit .el-dialog__body {
		    padding: 20px 20px;
		    color: #475669;
		    font-size: 14px;
		}
		#edit .el-dialog__footer {
		    padding: 0px 20px 15px;
		    margin-bottom:30px;
		    text-align: right;
		    box-sizing: border-box;
		}
    .container > .wrapp > .el-row {
      margin-bottom: 6px;
    }
  </style>
</block>
<block name="body">
	<div id="app" class="container">
		<div class="wrapp" v-show="show" style="display: none">
			<!-- seach form -->
			<el-row>
				<el-col :span="24"   >
					<el-form :inline="true"  ref="searchForm" :model="searchForm">
					  <el-form-item prop="name">
					   <el-input v-model="searchForm.name"  placeholder="请输入应聘人员姓名" >
					   </el-input>
					  </el-form-item>
					<el-form-item  prop="department_id" v-if="user_role_id == 18" >
			          <el-select v-model="searchForm.department_id" size="small" placeholder="请选择人事部所在部门" >
			            <el-option v-for="department in allDepartments" :label="department.name" :value="department.id"></el-option>
			          </el-select>
			        </el-form-item>
			      <!--     <el-form-item  prop="recommend" >
			      			        <el-select v-model="searchForm.recommend" size="small" placeholder="内部推荐或非内部推荐" >
			      <el-option v-for="recommend in recommendList" :label="recommend.name" :value="recommend.id"></el-option>
			      			        </el-select>
			      			      </el-form-item> -->
			      <el-form-item  prop="first_test" >
			        <el-select v-model="searchForm.first_test" size="small" placeholder="初试结果" >
			          <el-option v-for="test in testList" :label="test.name" :value="test.id"></el-option>
			        </el-select>
			      </el-form-item>
			      <el-form-item  prop="retest" >
			        <el-select v-model="searchForm.retest" size="small" placeholder="复试结果" >
			          <el-option v-for="retest in retestList" :label="retest.name" :value="retest.id"></el-option>
			        </el-select>
			      </el-form-item>
			      <el-form-item  prop="status" >
			        <el-select v-model="searchForm.status" size="small" placeholder="入职或试用期离职" >
			          <el-option v-for="status in statusList" :label="status.name" :value="status.id"></el-option>
			        </el-select>
			      </el-form-item>
			        <el-form-item  prop="info_sources" >
			        <el-select v-model="searchForm.info_sources" size="small" placeholder="信息来源" >
			          <el-option v-for="sources in sourcesList" :label="sources.name" :value="sources.id"></el-option>
			        </el-select>
			      </el-form-item>
					  <el-form-item> 
					    <el-button type="primary" size="small" icon="search" @click="loadDatalist">查询</el-button>
					    <el-button @click="searchReset" size="small" style="margin-left:10px;">重置</el-button>
					  </el-form-item>
            <el-form-item>
              <el-tooltip content="点击刷新当前页面" placement="right">
                <el-button @click="refresh" size="small" type="danger">刷新</el-button>
              </el-tooltip>
            </el-form-item>
					</el-form>
				</el-col>
			</el-row>
			<!-- / search form -->

			<!-- datatables  -->
			<el-row>
				<el-col :span="24">
					<el-table 
					  :data="dataList" 
				      v-loading="dataLoad" 
				      element-loading-text="{:L('DATA_LOGIN')}"
				      highlight-current-row
				      @current-change="handleSelectionChange" @row-dblclick="showDetail"
					
					 border>
					    <!-- <el-table-column type="selection"  width="50" >
					    </el-table-column> -->
					    <el-table-column  label="序号"  width="70" :formatter="handleIndex" >
					    </el-table-column>
 					    <el-table-column prop="user_id"  label="人事的姓名" width="150" align="center">
					         <template scope="scope">
					          {{ getType(scope.row.user_id, 'userNames') }}
					        </template>
					    </el-table-column>
					    <el-table-column prop="department_name"  label="人事所在部门" width="150" align="center">
					         <template scope="scope">
					          {{ getType(scope.row.department_id, 'departmentNames') }}
					        </template>
					    </el-table-column>
						 <el-table-column prop="name" label="应聘人员姓名" width="150" align="center">
					    </el-table-column>
					    <el-table-column prop="sex"  label="性别" width="80" align="center">
						    <template scope="scope">
					          {{ getType(scope.row.sex, 'sexType') }}
					        </template>
					    </el-table-column>
					    <el-table-column prop="first_test" label="初试结果" width="190" align="center">
					       <template scope="scope">
					          {{ getType(scope.row.first_test, 'testType') }}
					        </template>
					    </el-table-column>
					     <el-table-column prop="retest" label="复试结果" width="190" align="center">
					       <template scope="scope">
					          {{ getType(scope.row.retest, 'retestType') }}
					        </template>
					    </el-table-column>
					    <el-table-column prop="status" label="入职或试用期离职" width="190" align="center">
					       <template scope="scope">
					          {{ getType(scope.row.status, 'statusType') }}
					        </template>
					    </el-table-column>
					   <el-table-column prop="id_card" label="身份证号" width="192">
					   </el-table-column>
					    <el-table-column prop="mphone" label="手机" width="140" align="center">
					    </el-table-column>
					    <el-table-column prop="qq" label="QQ号" width="140" align="center">
					    </el-table-column>
						<el-table-column prop="weixin"  label="微信号" width="160" align="center">
					    </el-table-column>
					     <el-table-column prop="graduation_date" label="毕业时间" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="university" label="毕业院校" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="major" label="所学专业" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="position" label="应聘岗位" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="info_sources" label="信息来源" width="190" align="center">
					       <template scope="scope">
					          {{ getType(scope.row.info_sources, 'sourcesType') }}
					        </template>
					    </el-table-column>
					    <el-table-column prop="resume_enterprise_name" label="企业名称（简历）" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="resume_entry_date" label="任职开始日期（简历）" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="resume_quit_date" label="任职结束日期（简历）" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="resume_position" label="任职职务（简历）" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="resume_leader" label="直属上司姓名（简历）" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="resume_leader_phone" label="直属上司联系电话（简历）" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="resume_leaving_reasons" label="离职原因" width="190" align="center">
					    	<template scope="scope">
				                {{ scope.row.resume_leaving_reasons | handleString(10) }}
				            </template>
					    </el-table-column>
					      <el-table-column prop="interviewer_date" label="初试日期" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="interviewer_name" label="面试人姓名(初试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="interviewer_department" label="面试人所在部门(初试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="interviewer_mphone" label="面试人手机号(初试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="interviewer_qq" label="面试人QQ号(初试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="interviewer_opinion" label="初试意见" width="190" align="center">
					    	<template scope="scope">
				                {{ scope.row.interviewer_opinion | handleString(10) }}
				            </template>
					    </el-table-column>
					    
					      <el-table-column prop="retest_interviewer_date" label="复试日期" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="retest_interviewer_name" label="面试人姓名(复试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="retest_interviewer_department" label="面试人所在部门(复试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="retest_interviewer_mphone" label="面试人手机号(复试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="retest_interviewer_qq" label="面试人QQ号(复试)" width="190" align="center">
					    </el-table-column>
					    <el-table-column prop="retest_interviewer_opinion" label="复试意见" width="190" align="center">
					    		<template scope="scope">
				                {{ scope.row.retest_interviewer_opinion | handleString(10) }}
				            </template>
					    </el-table-column>
					     <el-table-column prop="recommend_name" label="推荐人姓名" width="190" align="center">
					    </el-table-column>
					   
					     <el-table-column prop="entry_date" label="入职日期" width="190" align="center">
					    </el-table-column>
					     <el-table-column prop="quit_date" label="离职日期" width="190" align="center">
					    </el-table-column>
					      
					    <el-table-column prop="created_at" label="创建时间" width="190" align="center">
					    </el-table-column>
					    <!-- {$viewDecorator['oprate']} -->
					    <el-table-column  :context="_self"  align="center" width="250" fixed="right"  label="操作"  >
						  <template scope="scope">
						    <el-button type="success" @click="handleEdit(scope.$index, scope.row)"     size="small">编辑</el-button>
						    <el-button type="danger"  @click="handleDelete(scope.$index, scope.row)"   size="small" >删除</el-button>
						  </template>
						</el-table-column> 
				</el-col>
			</el-row>
			<!-- / datatables  -->
			
			<!-- toolbar -->
				<el-row type="type"  justify="space-between" align="middle"  class="row-bg">
				  <el-col :span="12">
				  <div class="grid-content bg-purple">
				  	<el-button-group>
				  		<!-- {$viewDecorator['button']} -->
				  		<el-button size="small"  @click="openDialog('add')"  type="primary">添加信息</el-button>
						<el-button size="small"  @click="openDialog('employeeEntry')"  type="primary">入职</el-button>
						<el-button size="small"  @click="openDialog('employeeQuit')"  type="primary">试用期离职</el-button>
				    </el-button-group>
				    
				  </div>
				  </el-col>
				  <el-col :span="12">
				  <div class="grid-content bg-purple-light pull-right">
				    <!-- page -->
				    <include file="Common:_pagination" />
				    <!-- / page -->
				    
				  </div></el-col>
				</el-row>
			<!-- / toolbar -->
		</div>
		
		<div class="dialogWrapper" v-show="show" style="display: none">
			<!-- 高级查询 -->
			<!--<include file="_searchx" />-->
			<!-- / 高级查询 -->

			<!-- 添加 -->
			<include file="_add" />
			<!-- / 添加 -->

			<!-- 编辑 -->
			<include file="_edit" />
			<!-- / 编辑 -->

			<!-- 角色 -->
			<include file="_role" />
			<!-- / 角色 -->

			<!-- 修改身份信息 -->
			<include file="_editIDx" />
			<!-- / 修改身份信息 -->

			<!-- 确认身份 -->
			<include file="_editConfirmx" />
			<!-- / 确认身份 -->
			<include file="_detail" />
			<!-- 编辑 密码-->
			<include file="_employeeEntry" />
			<include file="_employeeQuit" />
		</div>

	</div>
</block>
<block name="scripts">
	<script>
		var validatePass2 = function(rule, value, callback)  {

	        if (window.defaultVm.employeeEntryForm.checkPass === '') {
	          callback(new Error('请再次输入密码'));
	        } else if (window.defaultVm.employeeEntryForm.checkPass !== window.defaultVm.$data.employeeEntryForm.password) {
	          callback(new Error('两次输入密码不一致!'));
	        } else {
	          callback();
	        }
	    }
        //手机号码
		  var checkPhone=function(rule,value,callback){
		     var phoneReg = /^1[34578]\d{9}$/;
		     if(value==='' || value===null){
		       callback();
		     }else if(!phoneReg.test(value)){
		       callback('手机号格式错误');
		     }else{
		       callback();
		     }
		  }
		 //qq号码
		  var checkQQ=function(rule,value,callback){
		    var number=/^\d+$/;
		    if(value==='' || value===null){
		      callback();
		    }else if(!number.test(value)){
		      callback('QQ号格式错误');
		    }else{
		      callback();
		    }
		  }

		   //限制文本字数为100字
		  var checkContent=function(rule,value,callback){
		   /* var contentReg=/^([\u4e00-\u9fa5]|[0-9_a-zA-Z]){1,100}$/;*/
		     //只能输入汉字、英文、数字和下划线,中英文的顿号，冒号，逗号，分号，句号，单引号，双引号，叹号，问号，小括号，间隔号。
		     var contentReg=/^([\u4e00-\u9fa5]|[0-9_a-zA-Z`:,;.''""!?()-·：，；。‘’“”！？（）-]){1,100}$/;
		    if(value==='' || value===null){
		      callback('标记红星的选项必填');
		    }else if(!contentReg.test(value)){
		      callback('文本字数不能超过100个字');
		    }else{
		      callback();
		    }
		  }
		     //限制名字字数为10字
		  var checkName=function(rule,value,callback){
		   /* var contentReg=/^([\u4e00-\u9fa5]|[0-9_a-zA-Z]){1,100}$/;*/
		     //只能输入汉字、英文、数字和下划线,中英文的顿号，冒号，逗号，分号，句号，单引号，双引号，叹号，问号，小括号，间隔号。
		     var contentReg=/^([\u4e00-\u9fa5]|[·]){1,10}$/;
		    if(value==='' || value===null){
		      callback();
		    }else if(!contentReg.test(value)){
		      callback('请输入不超过10个汉字！');
		    }else{
		      callback();
		    }
		  }
	</script>
	<script>
	Vue.filter('handleAddress',function(v){
		if (v!=null && v.length > 10) {
			var length = (arguments[1] || 10);
			return v.substring(0,length)+'......';  
		} else {
			return v;
		}
	})
	</script>
	<script>
		page.getUserRolesUrl="{:U('getUserRoles')}";
		page.setUserRolesUrl="{:U('setUserRoles')}";
		page.setEmployeeEntryUrl="{:U(setEmployeeEntry)}";
		page.setEmployeeQuitUrl="{:U(setEmployeeQuit)}";
		window.defaultOption.setDatas({
			roleList:{:json_encode($roleList)},
			allRoles:{:json_encode($allRoles)},
			allDepartmentsList:{:json_encode($allDepartmentsList)},
			allDepartments:{:json_encode($allDepartments)},
			detailFormDialog:false,
            showDetailList:[],
			pathInfo:{folder:'users'},
			resume_entry_date:"",
			 pickerOption1:{
		          disabledDate: function(time){
		              return time.getTime() > Date.now();
		          }
		      },
		      cleardate:false,

			addUpload:"",
			addUploadImg:false,

			editUpload:"",
			editUploadImg:false,

			xuploadheader:{"X-Requested-With":"XMLHttpRequest"},
			groupList:{:json_encode($groupList)},
			provinces:[],
			cities:[],
			districts:[],
			sexType:{:json_encode($sexType)},
			multipleSelection:[],

			employeeEntryRules:{
				entry_date:[
					{ type: 'date',required: true, message: '请输入入职日期',trigger: 'change'  }
				]
			},	
			employeeQuitRules:{
				quit_date:[
					{ type: 'date',required: true, message: '请输入离职日期', trigger: 'change'  }
				]
			},
			addRules:{
				
				name:[
					{ required: true, message: '请输入应聘人员姓名', trigger: 'blur' },
					{validator: checkName, trigger: 'blur'}
				],
				recommend_name:[
        			{pattern:/^([\u4e00-\u9fa5]|[·]){1,10}$/,message:'请输入不超过10个汉字！',trigger:'blur'}
 				],
				mphone:[
          			{required: true,message: '请输入应聘人员手机号', trigger: 'blur'},
          			{validator: checkPhone, trigger: 'blur'},
				],
				interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				retest_interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				info_sources:[
					{ required: true, message: '请输入信息来源', trigger: 'change'  }
				],
				first_test:[
					{ required: true, message: '请输入初试结果', trigger: 'change'  }
				],
				sex:[
					{required: true, message: '请选择性别', trigger: 'change'  }
				],
				qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				retest_interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				weixin:[
          			{pattern:/^[a-zA-Z]([a-zA-Z\d_-]){5,19}$/,message: '微信号格式错误',trigger: 'blur'}
				],
				id_card:[
        			{pattern:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,message:'身份证号格式错误',trigger:'blur'}
 				],
 				resume_leader_phone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				interviewer_date:[
					{ type: 'date', required: true, message: '请输入面试日期', trigger: 'change'  }
				],
			/*	retest_interviewer_date:[
					{ type: 'date', required: true, message: '请输入复试日期', trigger: 'change'  }
				],*/
				retest_interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				retest_interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				resume_leaving_reasons:[
					{validator: checkContent, trigger: 'blur'},
				],
				interviewer_opinion:[
					{validator: checkContent, trigger: 'blur'},
				],
				retest_interviewer_opinion:[
					{validator: checkContent, trigger: 'blur'},
				]
				
				

			},
			editRules:{
				name:[
					{ required: true, message: '请输入应聘人员姓名', trigger: 'blur' },
					{validator: checkName, trigger: 'blur'}
				],
				recommend_name:[
        			{pattern:/^([\u4e00-\u9fa5]|[·]){1,10}$/,message:'请输入不超过10个汉字！',trigger:'blur'}
 				],
				mphone:[
          			{required: true,message: '请输入应聘人员手机号', trigger: 'blur'},
          			{validator: checkPhone, trigger: 'blur'},
				],
				interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				retest_interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				info_sources:[
					{ required: true, message: '请输入信息来源', trigger: 'change'  }
				],
				first_test:[
					{ required: true, message: '请输入初试结果', trigger: 'change'  }
				],
				qq:[
					{validator: checkQQ, trigger:'blur'},
				],
				interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				retest_interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				weixin:[
          {pattern:/^[a-zA-Z]([a-zA-Z\d_-]){5,19}$/,message: '微信号格式错误',trigger: 'blur'}
				],
				id_card:[
        	{pattern:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,message:'身份证号格式错误',trigger:'blur'}
 				],
 				resume_leader_phone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
 				interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				interviewer_date:[
					{ type: 'date',required: true, message: '请输入面试日期',trigger: 'change'  }
				],
				/*retest_interviewer_date:[
					{ type: 'date', required: true, message: '请输入复试日期', trigger: 'change'  }
				],*/
				retest_interviewer_mphone:[
          			{validator: checkPhone, trigger: 'blur'},
				],
				retest_interviewer_qq:[
         			{validator: checkQQ, trigger:'blur'},
				],
				resume_leaving_reasons:[
					{validator: checkContent, trigger: 'blur'},
				],
				interviewer_opinion:[
					{validator: checkContent, trigger: 'blur'},
				],
				retest_interviewer_opinion:[
					{validator: checkContent, trigger: 'blur'},
				]
				


			},
			
			card_img:"",
			card_front:"",
			card_back:"",
			departmentItem:{$departmentItem},

			/*departments:{:json_encode($departments['list'])},*/
		groups:{:json_encode($departments['group'])},
		/*我加的 开始*/
		userNames:{:json_encode($userNames)},
		departmentNames:{:json_encode($departmentNames)},
		sexType:{:json_encode($sexType)},
		sourcesType:{:json_encode($sourcesType)},
		departments:{:json_encode($departments)},
		sourcesList:{:json_encode($sourcesList)},
		statusList:{:json_encode($statusList)},
		statusType:{:json_encode($statusType)},
		testList:{:json_encode($testList)},
		testType:{:json_encode($testType)},
		retestList:{:json_encode($retestList)},
		retestType:{:json_encode($retestType)},
		statusList:{:json_encode($statusList)},
		statusType:{:json_encode($statusType)},
		recommendList:{:json_encode($recommendList)},
		user_role_id:{$user_role_id},
		/*我加的 结束*/
			types:[
			    {name:"员工账号",value:'account'},
			{name:"员工姓名",value:'realname'},
			{name:"手机号",value:'mphone'},
            {name:"QQ号",value:'qq'},
            {name:"微信号",value:'weixin'}
			    ]
		}).setForm('add',{
			name:"",
			role_id:"",
			department_id:"",
			id:"",
			sex:0,
			recommend:"1",
			id_card:"",
			mphone:"",
			qq:"",
			weixin:"",
			graduation_date:"",
			university:"",
			major:"",
			position:"",
			info_sources:"",
			resume_enterprise_name:"",
			resume_entry_date:"",
			resume_position:"",
			resume_leader:"",
			resume_leader_phone:"",
			resume_leaving_reasons:"",
			interviewer_date:"",
			interviewer_name:"",
			interviewer_department:"",
			interviewer_mphone:"",
			interviewer_qq:"",
			interviewer_opinion:"",
			retest_interviewer_date:"",
			retest:"",
			retest_interviewer_name:"",
			retest_interviewer_department:"",
			retest_interviewer_mphone:"",
			retest_interviewer_qq:"",
			retest_interviewer_opinion:"",
			type:"",
			first_test:"",
			resume_entry_date:"",
			resume_quit_date:""
		}).setForm('edit',{
			name:"",
			role_id:"",
			department_id:"",
			id:"",
			sex:0,
			recommend:"0",
			id_card:"",
			mphone:"",
			qq:"",
			weixin:"",
			graduation_date:"",
			university:"",
			major:"",
			position:"",
			info_sources:"",
			resume_enterprise_name:"",
			resume_entry_date:"",
			resume_position:"",
			resume_leader:"",
			resume_leader_phone:"",
			resume_leaving_reasons:"",
			interviewer_date:"",
			interviewer_name:"",
			interviewer_department:"",
			interviewer_mphone:"",
			interviewer_qq:"",
			interviewer_opinion:"",
			retest_interviewer_date:"",
			retest:"",
			retest_interviewer_name:"",
			retest_interviewer_department:"",
			retest_interviewer_mphone:"",
			retest_interviewer_qq:"",
			retest_interviewer_opinion:"",
			type:"",
			first_test:"",
			resume_entry_date:"",
			resume_quit_date:""
		}).setForm('setRoles',{
			user_id:0,
			role_ids:0
		},true).setForm('search',{
			department_id:{:json_encode($departments['account'][0]['id'])},
			name:"",
			type:"",
			first_test:"",
			retest:"",
			status:"",
			info_sources:""
		}).setForm('employeeEntry',{
			id:"",
			entry_date:""
		}, true).setForm('employeeQuit',{
			id:"",
			quit_date:""
		}, true).setMethod('getType', function(type, field){
			return this[field][type];
		}).setMethod('departmentChange',function () {
			var vmThis=this
			vmThis.$http.get('{:U("getAllGroups")}',{params:{department_id:vmThis.searchForm.department_id}}).then(function (response) {
				vmThis.groups=response.body
				vmThis.searchForm.group_id=''
            })
        }).setMethod('dateChange',function(v){
    this.addForm.resume_entry_date = v;
    this.resume_entry_date=v
  }).setMethod('dateChanges',function(v){
      this.addForm.resume_quit_date = v;
  }).setMethod('getTime',function(v){
			if(v==null || v==""){
				return v;
			}else{
		      var date = new Date(v*1000);
			  var year = date.getFullYear();
			  var month = date.getMonth()+1;
			  var day = date.getDate();
			  var hour = date.getHours();
			  var minute = date.getMinutes();
			  var second = date.getSeconds();
			  month=month<10?'0'+month:month;
			  day=day<10?'0'+day:day;
			  hour=hour<10?'0'+hour:hour;
			  minute=minute<10?'0'+minute:minute;
			  second=second<10?'0'+second:second;
			  return year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
			}
	
		}).setMethod('handleSetRoles', function(index, row){
			// var vmThis = this;
			var f = FormName.getForm('setRoles');
			this[f].user_id = row.id;
			this[f].role_ids = row.role_id;
			
			this.openDialog('setRoles');
			
		}).setMethod('addFormUploadSuccess', function(response, file, fileList){
			this.addUpload = '__ROOT__'+ response.path;
			this.addUploadImg = true;
			this.addForm.head = response.path
		}).setMethod('addFormUploadError', function(err, response, file){
			this.$message.error('上传出错：' + response.info);
		}).setMethod('editFormUploadSuccess', function(response, file, fileList){
			this.editUpload = '__ROOT__'+ response.path;
			this.editUploadImg = true;
			this.editForm.head = response.path
		}).setVueHook('mounted', function(){
	    var vmThis = this;
	    this.$http.get('{:U("Area/getAreasByPid")}', {params:{pid:1} }).then(function(response){
	      var provinces = [];
	      response.body.forEach(function(currentValue,index){
	        provinces.push({id: currentValue.id, name: currentValue.name});
	      })
	      vmThis.$set(vmThis, 'provinces', provinces);
	    });
	  }).setMethod('provinceChange', function(v){
	    var vmThis = this;
	    this.$http.get('{:U("Area/getAreasByPid")}', {params:{pid:v} }).then(function(response){
	      var cities = [];
	       response.body.forEach(function(currentValue,index){
	        cities.push({id: currentValue.id, name: currentValue.name});
	       })
	       vmThis.$set(vmThis, 'cities', cities);
	       vmThis.$set(vmThis['addForm'], 'area_city', "");
	    })
	  }).setMethod('cityChange', function(v){
	    var vmThis = this;
	    this.$http.get('{:U("Area/getAreasByPid")}', {params:{pid:v} }).then(function(response){
	      var cities = [];
	       response.body.forEach(function(currentValue,index){
	        cities.push({id: currentValue.id, name: currentValue.name});
	       })
	       vmThis.$set(vmThis, 'districts', cities);
	    })
	  }).setMethod('handleEdit', function(index, row){
	  		var type ='edit';
	  		var tar = {};
	  		Oassign(tar, row);
	  		Oassign(tar, row.userInfo);
	  		delete tar.userInfo;
		  	this.initObject( this[FormName.getFormName(type)], tar );
			this.editIndex = index;
			this.editUpload = '__ROOT__'+ tar.head;
			this.editUploadImg = true;
			this.openDialog(type);
	  }).setMethod('beforeEdit',function(){
	    if (!this.$refs['editselect']) {
	      this.provinceChange(this.editForm.area_province);
	      this.cityChange(this.editForm.area_city);
	    }
	  }).setMethod('beforeSetEmployeeEntry', function(){
	    var form = 'employeeEntry';
	    var vmThis = this;
	    if (this.multipleSelection.length ==0 ) {
	      this.closeDialog(form);
	      this.$message.error('请先选择一条信息');
	    } else if(this.multipleSelection.length > 1){
	    	this.closeDialog(form);
	        this.$message.error('只能选择一条信息');
	    } else {
	       var row = this.multipleSelection[0];
	       this.employeeEntryForm.id = row.id;
	       this.employeeEntryForm.entry_date = row.entry_date;
	    }
	  }).setMethod('afterSetEmployeeEntry',function(){
	  	   this.employeeEntryForm.id = "";
	       this.employeeEntryForm.entry_date = "";
	  }).setMethod('beforeSetEmployeeQuit', function(){
	    var form = 'employeeQuit';
	    var vmThis = this;
	    if (this.multipleSelection.length ==0 ) {
	      this.closeDialog(form);
	      this.$message.error('请先选择一个员工');
	    } else if(this.multipleSelection.length > 1){
	    	this.closeDialog(form);
	        this.$message.error('只能选择一个员工');
	    } else {
	       var row = this.multipleSelection[0];
	       this.employeeQuitForm.id = row.id;
	       this.employeeQuitForm.quit_date = row.quit_date;
	    }
	  }).setMethod('afterSetEmployeeQuit',function(){
	  	   this.employeeQuitForm.id = "";
	       this.employeeQuitForm.quit_date = "";
	  }).setMethod('handleSelectionChange', function(val){
	    //this.multipleSelection = val;
	     this.deleteArrAllItem('multipleSelection');
	     this.multipleSelection.push(val) ;
	  }).setMethod('setImgUrl', function(url){
	  	return '__ROOT__' + url;
	  }).setMethod('closeSetRole', function(){
	  	 // this.dataReload();
	  }).setMethod('cardImg', function(response, file, fileList){
			// this.card_img = '__ROOT__'+ response.path;
			this.addForm.card_img = response.path
	  }).setMethod('cardFront', function(response, file, fileList){
			// this.card_front = '__ROOT__'+ response.path;
			this.addForm.card_front = response.path
	  }).setMethod('cardBack', function(response, file, fileList){
			// this.card_back = '__ROOT__'+ response.path;
			this.addForm.card_back = response.path
	  }).setMethod('editCardImg', function(response, file, fileList){
			// this.card_img = '__ROOT__'+ response.path;
			this.editForm.card_img = response.path
	  }).setMethod('editCardFront', function(response, file, fileList){
			// this.card_front = '__ROOT__'+ response.path;
			this.editForm.card_front = response.path
	  }).setMethod('editCardBack', function(response, file, fileList){
			// this.card_back = '__ROOT__'+ response.path;
			this.editForm.card_back = response.path
	  }).setMethod('beforeAvatarUpload', function(file){
	  	var  isLt8M = file.size / 1024 / 1024 < 8;

	  	if (!isLt8M) {
          this.$message.error('上传头像图片大小不能超过 8MB!');
        }

        return isLt8M;
	  }).setMethod("handleQuit", function(index, row, url){
			if (!arguments[2]) {
				url= this.page.deleteUrl;
			}
			var vmThis = this;
			this.$confirm('确定离职?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
	    }).then(function(){
      	vmThis.$http.post(url, {ids:[row.id]}).then(function(response){
      		var message = '离职成功!';
      		if (response.body.info) {
      			message = response.body.info;
      		}
      		vmThis.$message({
	            type: 'success',
	            message: message
	          });

      		// vmThis.dataList.splice(index, 1);

      		vmThis.loadDatalist();
      		//this.dataLoad = true;
	       // this.loadDatalist();

	      	}, function(response){
	      		var message = '离职失败';
	      		if (response.body.info) {
	      			message = response.body.info;
	      		}
	      		vmThis.$message({
		            type: 'error',
		            message: '离职失败'
		          });
	      })
	    }).catch(function() {
        vmThis.$message({
          type: 'info',
          message: '已取消离职'
        });          
	    });
	  }).setMethod("entryDataChange", function(v){
	  	this.employeeEntryForm.entry_date = v;
	  }).setMethod("quitDataChange", function(v){
	  	this.employeeQuitForm.quit_date = v;
	  }).setMethod("interviewerDateAddChange", function(v){
	  	this.addForm.interviewer_date = v;
	  }).setMethod("interviewerDateEditChange", function(v){
	  	this.editForm.interviewer_date = v;
	  }).setForm('detail',{
			realname:"",
		}, true).setMethod('showDetail', function(row){
	    //this.account = row.account;
	    this.showDetailList = row;
	    this.openDialog('detail');
	  });
	</script>
</block>
